package com.xf.common.redis.lang;

import org.springframework.lang.Nullable;

import java.util.Objects;

/**
 * @Description
 * @Author FengYi
 * @Date 2020-06-19 10:12
 */
public class ObjectUtil extends org.springframework.util.ObjectUtils {

    /**
     * 判断元素不为空
     *
     * @param obj object
     * @return boolean
     */
    public static boolean isNotEmpty(@Nullable Object obj) {
        return !ObjectUtil.isEmpty(obj);
    }

    /**
     * 判断元素长度是否超过指定长度
     * 超过返回true
     */
    public static boolean checkLength (Object obj, int length){
        if (Objects.isNull(obj)){
            return false;
        }
        return length < String.valueOf(obj).length();
    }

}